﻿using System;
using Gp.Scripts.Core;
using QFramework;
using UnityEngine;

namespace Gp.Scripts.Core {
    public class UnitUnderIndicator : UnitSubObject {
        [SerializeField] private Transform selectionMark;

        protected override void OnInit() {
            UnitReference.RegisterEvent<Event_Unit.Highlight>(ShowSelectionMark);
            UnitReference.RegisterEvent<Event_Unit.DeHighlight>(HideSelectionMark);
        }

        private void HideSelectionMark(Event_Unit.DeHighlight obj) {
            selectionMark.Hide();
        }

        private void ShowSelectionMark(Event_Unit.Highlight obj) {
            selectionMark.Show();
        }




        private void Update() {
            if (selectionMark) selectionMark.transform.RotationIdentity();
        }
    }
}